﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Excel = Microsoft.Office.Interop.Excel;

namespace QuickExcel
{
    public partial class ImportFile : Form
    {
        public ImportFile()
        {
            InitializeComponent();
            txtRange.Text = Globals.ThisAddIn.Application.ActiveCell.Address;            
        }
        
        private void cmdBrowseFile_Click(object sender, EventArgs e)
        {
            string filename;
            openFileDialog.ShowDialog();
            filename = openFileDialog.FileName;

            txtFileLocation.Text = filename;
        }

        private void cmdOK_Click(object sender, EventArgs e)
        {
            if (txtFileLocation.Text == "")
                System.Windows.Forms.MessageBox.Show("Filename cannot be NULL");

            else
            {                
                ImportFileSheetOptions sheetOptions = new ImportFileSheetOptions(txtFileLocation.Text,txtRange.Text);
                sheetOptions.Show();                
            }

            this.Close();
        }

        private void cmdCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }


    }
}
